pub mod feitu;

use async_trait::async_trait;
use super::config::AccountConfig;

#[async_trait]
pub trait Task: Send + Sync {
    /// 执行任务(带账号配置和任务级代理)
    async fn execute(&self, account: &AccountConfig, task_proxy: Option<&String>) -> Result<(), String>;
    
    /// 获取任务名称
    fn get_name(&self) -> String;
    
    /// 获取任务显示名称(包含账号昵称)
    #[allow(dead_code)]
    fn get_display_name(&self, account: &AccountConfig) -> String {
        format!("{}({})", self.get_name(), account.nickname)
    }
}

pub struct TaskManager;

impl TaskManager {
    pub fn get_task(name: &str) -> Option<Box<dyn Task>> {
        match name {
            "feitu" => Some(Box::new(feitu::FeituTask)),
            _ => None,
        }
    }
}
